package org.luckyjourney.listener;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.EventListener;
import org.springframework.session.events.SessionDestroyedEvent;
import org.springframework.stereotype.Component;

@Component
public class CustomSessionEventListener {

    /**
     * 当网站被关闭时触发 TODO 测试
     * @param event
     * @return void
     */
    @EventListener
    public void handleSessionDestroyedEvent(SessionDestroyedEvent event) {
        // 在会话销毁时执行你的自定义逻辑
        String sessionId = event.getSessionId();
        System.out.println("Session with ID " + sessionId + " has been destroyed.");
        // 在这里添加你的自定义逻辑
    }
}